package com.mayisoftware.mayioa.business.flow.api.service;

import com.mayisoftware.mayioa.business.flow.api.domain.BaseFlowInfo;
import com.mayisoftware.mayioa.platform.api.domain.SysUser;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.variable.api.history.HistoricVariableInstance;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 通用的计划流程控制服务
 */
public interface IFlowBaseService {

    /**
     * 创建一个报名流程
     */
    ProcessInstance createFlow(SysUser user, String planId,String signRemark);

    /**
     * 查询历史流程节点信息
     */
     List<HistoricActivityInstance> queryProcessActivityInfos(String processId);
    /**
     * 查询用户的所有任务
     */
     List<Task> queryTasks(String userId, String userList,List<String> groupIds);

    /**
     * 通过任务
     */
    boolean apply(String taskId,String remark) ;

    /**
     * 驳回任务
     */
    boolean reject(String taskId,String remark) ;


    /**
     * 生成流程图
     */
    void genProcessDiagram(HttpServletResponse httpServletResponse, String processId) ;

    /**
     * 查询流程是否完成
     */
    boolean isFinished(String processInstanceId);

    /**
     * 查询历史流程信息
     */
    HistoricProcessInstance queryProcessInfo(String processInstanceId) ;

    /**
     * 查询历史流程的任务信息
     */
    List<HistoricTaskInstance> queryProcessTaskInfos(String processId);

    /**
     * 查询历史流程的变量信息
     */
    List<HistoricVariableInstance> queryProcessVariableInfos(String processId);
}
